Skip to content

misc: add GLiNER2 Modal demo (extract_json + classify_text)#1530

Open
vish86 wants to merge 4 commits intomodal-labs:mainfrom
vish86:misc/add-gliner2-modal-demo
Open

misc: add GLiNER2 Modal demo (extract_json + classify_text)#1530
vish86 wants to merge 4 commits intomodal-labs:mainfrom
vish86:misc/add-gliner2-modal-demo

Conversation

@vish86
Copy link
Copy Markdown

@vish86 vish86 commented Mar 25, 2026

Summary

  • Adds misc/gliner2_modal_demo.py: load fastino/gliner2-base-v1 in @modal.enter(), run extract_json and classify_text on the same string in one remote method.
  • Dependencies are declared inline via pip_install on the image (single file, no separate requirements).

Run

From the repo root:

modal run misc/gliner2_modal_demo.py

Optional:

modal run misc/gliner2_modal_demo.py --text "Your paragraph here."

Notes


Open with Devin

vish86 and others added 3 commits January 31, 2026 08:06
Runs extract_json and classify_text on the same text with a Modal cls
and requirements file co-located under misc/.

Made-with: Cursor
devin-ai-integration[bot]

This comment was marked as resolved.

Remove co-located requirements file; dependencies live in the example script.

Made-with: Cursor
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 5 additional findings in Devin Review.

Open in Devin Review

@@ -0,0 +1,72 @@
# ---
# cmd: ["python", "misc/kafka_microbatch_etl.py", "--batch=25", "--timeout-s=5", "--local=true"]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Frontmatter cmd uses python but file has no if __name__ == "__main__" block

The frontmatter specifies cmd: ["python", "misc/kafka_microbatch_etl.py", ...], but the file uses @app.local_entrypoint() (line 68) with no if __name__ == "__main__" block. Running with python directly will import the module and exit without executing anything — @app.local_entrypoint() is only invoked by modal run. Every other example in this repo that uses cmd: ["python", ...] has a if __name__ == "__main__" block (e.g., 06_gpu_and_ml/gpu_snapshot.py:62, misc/queue_simple.py:51). The documented command silently does nothing.

Suggested change
# cmd: ["python", "misc/kafka_microbatch_etl.py", "--batch=25", "--timeout-s=5", "--local=true"]
# cmd: ["modal", "run", "misc/kafka_microbatch_etl.py", "--batch=25", "--timeout-s=5", "--local"]
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant